<?php

use yii\helpers\Html;
use kartik\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\modules\business\models\BusinessCustomerCategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '大客户分类';
$this->params['breadcrumbs'][] = $this->title;
?>


<section class="wrapper site-min-height">
    <!-- page start-->
    <section class="panel">
        <header class="panel-heading">
              <?= Html::a('返回','javascript:history.back(-1)'); ?>  <?= Html::encode($this->title) ?>
        </header>
        <div class="panel-body">
            <div class="adv-table editable-table ">
 


<div class="business-customer-category-index">

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('添加大客户分类', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?php
    echo GridView::widget([
        'dataProvider'=>$dataProvider,
        'filterModel'=>$searchModel,
        'showPageSummary'=>true,
        'pjax'=>true,
        'striped'=>true,
        'hover'=>true,
        'panel'=>['type'=>'primary', 'heading'=>'大客户分类管理'],
        'containerOptions'=>['style'=>'overflow: auto'], // only set when $responsive = false
        'headerRowOptions'=>['class'=>'kartik-sheet-style'],
        'filterRowOptions'=>['class'=>'kartik-sheet-style'],
        'columns'=>[
            [
                'attribute'=>'name',
                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                'width'=>'100px',
            ],

            [
                'label' => '上级分类',
                'attribute'=>'parent.name',
                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                'width'=>'100px',
            ],
            [
                'class' => '\kartik\grid\ActionColumn',
                'template' => '{view} {update} {delete} {addcontract}',
                'buttons' => [
                    'addcontract' => function ($url, $model) {
                        return Html::a('<span class="glyphicon glyphicon-plus">添加大客户</span>','/business/customer/create?cateid='.$model->id,[
                            'title' => '添加合同','class'=>'pdetail','data-id'=>$model->id,
                        ]);
                    }
                ],
            ],
        ],
        'toolbar'=> [
            '{export}',
            '{toggleData}',
        ],
        'bordered'=>true,
        'condensed'=>true,
    ]);
    ?>
</div>
</div>
</div>
</section>
</section>





